{if $member || $_GET['m']=='oauth'}
{else}
<style type="text/css">

	.link{
		text-align: right;
		line-height: 20px;
		padding-right: 40px;
	}
	
	.d-ui-dialog{ 
		width: 380px;
		height: auto;
		display: none;
		position: fixed;
		justify-content: center;
		z-index: 9000;
		top: 0px;
		left: 0px;
		border: 1px solid #D5D5D5;
		background: #fff;
		
		/*z-index: 999999;
		position: fixed;
		justify-content: center;
		top: 50%;
		left: 50%;

		width: 700px;

		overflow: auto;
		background: #ffffff;
		transform: translate(-50%, -50%);
		box-shadow: 0 0 20px #d6d6d6;*/
		background-color: rgba(255, 255, 255, 1.0);
		border-radius: 10px;
	}

	.d-ui-dialog a{text-decoration: none;}

	.d-ui-dialog-title{
		height: 48px;
		line-height: 48px; 
		padding:0px 20px;
		color: #535353;
		font-size: 16px;
		border-bottom: 1px solid #efefef;
		/*background: #f5f5f5;*/
		cursor: move;
		user-select:none;
	}
	.d-ui-dialog-closebutton{
		width: 16px;
		height: 16px;
		display: block;
		
		
		/*position: absolute;*/
		/*top: 12px;
		right: 20px;*/
		background: url({HOME_THEME_PATH}web/img/close_def.png) no-repeat;
		cursor: pointer;

	}
	.d-ui-dialog-closebutton:hover{
		background:url({HOME_THEME_PATH}web/img/close_hov.png);
		}

	.d-ui-dialog-content{
		padding: 15px 20px;
	}
	.d-ui-dialog-pt15{
		padding-top: 15px;
	}
	.d-ui-dialog-l40{
		height: 50px;
		line-height: 40px;
		text-align: right;
	}

	.d-ui-dialog-input{
		width: 100%;
		height: 40px;
		margin: 0px;
		padding:0px;
		border: 1px solid #d5d5d5;
		font-size: 16px;
		color: #000;
		text-indent: 25px;
		outline: none;
		border-radius: 50px;
	}
	.d-ui-dialog-input-username{
		background: url({HOME_THEME_PATH}web/img/input_username.png) no-repeat 2px ;
	}

	.d-ui-dialog-input-password{
		background: url({HOME_THEME_PATH}web/img/input_password.png) no-repeat 2px ;
	}
	.d-ui-dialog-input-rzm{
		background: url({HOME_THEME_PATH}web/img/input_rzm.png) no-repeat 2px ;
	}
	.d-ui-dialog-submit{
		width: 100%;
		height: 50px;
		{if $qingchunkaiqi}
		background: {$qingchunzhuse};
		{else}
		background: #11d2b5;
		{/if}
		
		border:none;
		font-size: 16px;color: #fff;
		outline: none;
		text-decoration: none;
		display: block;
		text-align: center;
		line-height: 50px;
		border-radius: 50px;
	}
	.d-ui-dialog-submit:hover{
		{if $qingchunkaiqi}
		background: {$qingchunzhuse};
		{else}
		background: #0c9d85;
		{/if}
		color: #ffffff;
	}

	.d-ui-mask{ 
		width: 100%;
		height:100%;
		background: #000;
		position: fixed;
		top: 0px;
		height: 0px;
		z-index: 8000;
		opacity:0.4; 
		filter: Alpha(opacity=40);
	}
</style>


<div class="d-ui-mask" id="mask" onselectstart="return false"></div>

<div class="d-ui-dialog" id="dialogMove" onselectstart='return false;'>
	<div class="d-ui-dialog-title" id="dialogDrag"  onselectstart="return false;" >
		
		账号登录

		

	</div>
	<form class="content" id="loginform" method="post" novalidate="novalidate">
		
	    {dr_form_hidden()}
			<div class="d-ui-dialog-content">
				<div class="d-ui-dialog-l40 d-ui-dialog-pt15">
					<input class="d-ui-dialog-input d-ui-dialog-input-username" name="data[username]" autocomplete="off" type="input" placeholder="手机/邮箱/用户名" value="" />
				</div>
				<div class="d-clear"></div>
				<div class="d-ui-dialog-l40 d-ui-dialog-pt15 d-shang-10">
					<input class="d-ui-dialog-input d-ui-dialog-input-password" name="data[password]" autocomplete="off" type="password" placeholder="密码" value="" />
				</div>
				 {if $ci->member_cache['login']['code']}
				 <div class="d-ui-dialog-l40 d-ui-dialog-pt15 d-shang-10">
				 	<input class="d-ui-dialog-input d-ui-dialog-input-rzm" name="code" autocomplete="off" type="text" placeholder="验证码" value="" />
				 </div>
				 <div class="d-shang-10">
				     {dr_code(120, 35)}
				 </div>
				    
				{/if}
				<div class="d-clear"></div>
				
				
				<div class="d-kuan d-shang-10">
					<label class="">
						<input type="checkbox" name="remember" value="1"> 记住登录
						<span></span>
					</label>
				</div>
				
				<div class="d-kuan ">
					{if isset($ci->member_cache['oauth']['weixin']['id']) && $ci->member_cache['oauth']['weixin']['id']}
					<!--a href="{Router::oauth_url('wechat', 'login', $my_web_url)}">
						 
						 <div class="d-neikuang-8-20 d-beijing-hei d-yuanjiao-20 pull-right d-zitiyanse-bai"><i class="fa fa-wechat"></i>公众号登录 </div>
					</a-->
					<!--img style="width:40" src="{HOME_THEME_PATH}web/img/weixin.png" class="d-xia-10"-->
					{/if}
					
					{if isset($ci->member_cache['oauth']['qq']['id']) && $ci->member_cache['oauth']['qq']['id']}
						
							<a href="{Router::oauth_url('qq', 'login')}" class="d-yuanjiao-50">
								<img src="{HOME_THEME_PATH}web/img/qq.png" width="38" height="38" class="d-yuanjiao-50 d-you-10">
							</a>
						
					{/if}
					{if isset($ci->member_cache['oauth']['weixins']['id'])}
							<a target="_blank" href="{Router::oauth_url('weixin', 'login')}">
								<div class="d-neikuang-8-20 d-denglu-weixin d-yuanjiao-20 pull-left d-zitiyanse-bai d-xia-10"><i class="fa fa-wechat"></i> 微信登录</div>
							</a>
					{/if}
				</div>
				
				<div>
					 <button type="button" onclick="dr_ajax_member('/index.php?s=api&c=sso&m=login', 'loginform','{$my_web_url}');" class="d-ui-dialog-submit"> 登录 </button>
					<!--a class="d-ui-dialog-submit" href="#" >登录</a-->
				</div>
				
				<div class="d-kuan ">
					
					<div class="col-xs-6 d-shang-15 d-wenzi-juzhong">
						<a href="{dr_member_url('login/find')}" >忘记密码</a> 
					</div>
					<div class="col-xs-6 d-shang-15 d-wenzi-juzhong">
						<a href="{dr_member_url('register/index')}" class="d-zuo-10">立即注册</a>
					</div>
					<div class="col-sm-12 d-wenzi-juzhong d-shang-15 d-xia-15">
						<a class="d-ui-dialog-closebutton d-kuan-juzhong" href="javascript:hideDialog();"></a>
					</div>
					
					
				</div>
			</div>
	    
	</form>
</div>
<style>
	.d-denglu-weixin {
	    color: #FFF;
	    {if $qingchunkaiqi}
	    background-color: {$qingchunzhuse};
	    border-color: {$qingchunzhuse};
	    {else}
	    background-color: #11d2b5;
	    border-color: #11d2b5;
	    {/if}
	}
</style>

<script type="text/javascript">
	
	$('#mask').hide();
	$('#dialogMove').hide();

	var dialogInstace , onMoveStartId , mousePos = {x:0,y:0};	//	用于记录当前可拖拽的对象
	
	// var zIndex = 9000;

	//	获取元素对象	
	function g(id){return document.getElementById(id);}

	//	自动居中元素（el = Element）
	function autoCenter( el ){
		var bodyW = document.documentElement.clientWidth;
		var bodyH = document.documentElement.clientHeight;

		var elW = el.offsetWidth;
		var elH = el.offsetHeight;

		el.style.left = (bodyW-elW)/2 + 'px';
		el.style.top = (bodyH-elH)/2 + 'px';
		
	}

	//	自动扩展元素到全部显示区域
	function fillToBody( el ){
		el.style.width  = document.documentElement.clientWidth  +'px';
		el.style.height = document.documentElement.clientHeight + 'px';
	}

	//	Dialog实例化的方法
	function Dialog( dragId , moveId ){

		var instace = {} ;

		instace.dragElement  = g(dragId);	//	允许执行 拖拽操作 的元素
		instace.moveElement  = g(moveId);	//	拖拽操作时，移动的元素

		instace.mouseOffsetLeft = 0;			//	拖拽操作时，移动元素的起始 X 点
		instace.mouseOffsetTop = 0;			//	拖拽操作时，移动元素的起始 Y 点

		instace.dragElement.addEventListener('mousedown',function(e){

			var e = e || window.event;

			dialogInstace = instace;
			instace.mouseOffsetLeft = e.pageX - instace.moveElement.offsetLeft ;
			instace.mouseOffsetTop  = e.pageY - instace.moveElement.offsetTop ;
			
			onMoveStartId = setInterval(onMoveStart,10);
			return false;
			// instace.moveElement.style.zIndex = zIndex ++;
		})

		return instace;
	}

	//	在页面中侦听 鼠标弹起事件
	document.onmouseup = function(e){
		dialogInstace = false;
		clearInterval(onMoveStartId);
	}
	document.onmousemove = function( e ){
		var e = window.event || e;
		mousePos.x = e.clientX;
		mousePos.y = e.clientY;
		

		e.stopPropagation && e.stopPropagation();
		e.cancelBubble = true;
		e = this.originalEvent;
        e && ( e.preventDefault ? e.preventDefault() : e.returnValue = false );

        document.body.style.MozUserSelect = 'none';
	}

	function onMoveStart(){


		var instace = dialogInstace;
	    if (instace) {
	    	
	    	var maxX = document.documentElement.clientWidth -  instace.moveElement.offsetWidth;
	    	var maxY = document.documentElement.clientHeight - instace.moveElement.offsetHeight ;

			instace.moveElement.style.left = Math.min( Math.max( ( mousePos.x - instace.mouseOffsetLeft) , 0 ) , maxX) + "";
			instace.moveElement.style.top  = Math.min( Math.max( ( mousePos.y - instace.mouseOffsetTop ) , 0 ) , maxY) + "";

	    }

	}

	//	重新调整对话框的位置和遮罩，并且展现
	function showDialog(){
		g('dialogMove').style.display = 'block';
		g('mask').style.display = 'block';
		autoCenter( g('dialogMove') );
		fillToBody( g('mask') );
		
	}
	function d_wx_login() {    
		layer.open({    
			type: 2,    
			title: '微信扫码登录',    
			shadeClose: false,    
			shade: 0.8,    
			area: ['380px', '430px'],    
			content: '/index.php?s=api&c=oauth&m=index&name=wechat&type=login&back='
		});    
	}

	//	关闭对话框
	function hideDialog(){
		g('dialogMove').style.display = 'none';
		g('mask').style.display = 'none';
	}

	//	侦听浏览器窗口大小变化
	// window.onresize = showDialog;

	Dialog('dialogDrag','dialogMove');
	
	//默认设置弹出层启动
	//showDialog();
	function d_weixin_notify() {
        $.ajax({
            type : "post",
            url : "/index.php?s=api&c=oauth&m=index&name=wechat&type=login&back=",
            dataType : "json",
            success : function(json){
                if (json.code == 1) {
                    $('#wx_default_tip').hide();
                    $('#wx_after_scan').show();
                    var oss_url = json.data.sso;
                    // 发送同步登录信息
                    for(var i in oss_url){
                        $.ajax({
                            type: "GET",
                            url:oss_url[i],
                            dataType: "jsonp",
                            success: function(json){ },
                            error: function(){ }
                        });
                    }
                    if (json.data.url) {
                        setTimeout("window.location.href = '"+json.data.url+"'", 2000);
                    } else{
                        setTimeout("window.location.href = '{$back_url}'", 2000);
                    }
                } else {
                    // alert('没有收到扫码信息');
                }
            },
            error:function(){ }
        });
    }

</script>
{/if}

